{include file="public/header" /}
<link rel="stylesheet" href="/static/admin/css/base.css" media="all">
<style>
    html {
        background-color: #f2f2f2 !important;
    }
    .layui-form-item {
        margin-bottom: 0 !important;
    }
    .underline{
        text-decoration: underline;color: #00a2d4
    }
    tr th:last-child {
        border-right: 0 !important;
    }
    .layui-card-body {

        padding: 10px 1px!important;
    }
    .pagination {
            display: inline-block;
            padding-left: 0;
            margin: 20px 0;
            border-radius: 4px;
        }
        .pagination>li {
            display: inline;
        }
        .pagination>li>a, .pagination>li>span {
            position: relative;
            float: left;
            padding: 6px 12px;
            margin-left: -1px;
            line-height: 1.42857143;
            color: #009688;;
            text-decoration: none;
            background-color: #fff;
            border: 1px solid #ddd;
        }
        .pagination>li:first-child>a, .pagination>li:first-child>span {
            margin-left: 0;
            border-top-left-radius: 4px;
            border-bottom-left-radius: 4px;
        }
        .pagination>.active>a, .pagination>.active>a:focus, .pagination>.active>a:hover, .pagination>.active>span, .pagination>.active>span:focus, .pagination>.active>span:hover {
            z-index: 3;
            color: #fff;
            cursor: default;
            background-color: #009688;;
            border-color: #009688;;
        }
        .sr-only {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0,0,0,0);
            border: 0;
        }
        
	.current{background-color: #009688 !important;color: #fff !important;}
    .layui-input-block{width: 50%}
    .layui-table tr td {
        min-width:150px !important;
    }
    .layui-table tr td:first-child {
        min-width:50px !important;
    }
</style>
<body>

<div class="layui-fluid layui-anim-fadein">
    <div class="layui-card">
        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                            
                        <div style="display: flex;align-items: center;justify-content: space-between">
                            <div class="layui-btn-container" style="flex: 1">
                                <label  class="layui-btn layui-bg-cyan layui-btn-sm" onclick="exportexcel();">
                                    <i class="layui-icon layui-icon-export"></i>导出数据
                                </label>
                            </div>
                        </div>
                        
                            
                        <div class="nav_search">
                            <form class="layui-form search-form" lay-filter="search-form" style="display: flex;flex-wrap: wrap;flex: 1">

                                <div class="layui-form-item  layui-col-xs2">
                                    <div class="layui-inline" style="width: 98%">
                                        <select name="district_id" id="district_id">
                                            
                                            <option value="0" <?php if($district_id == 0){?>selected<?php }?>>选择挂牌区域</option>
                                            {foreach name="dist" item="v"}
                                            <option value="{$v.id}" <?php if($district_id == $v['id']){?>selected<?php }?>>{$v.title}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </div>
                                
                                <div class="layui-form-item  layui-col-xs2">
                                    <div class="layui-inline" style="width: 98%">
                                        <select name="pro_id" id="pro_id">
                                            
                                            <option value="0" <?php if($pro_id == 0){?>selected<?php }?>>选项目类别</option>
                                            {foreach name="prolist" item="v"}
                                            <option value="{$v.id}" <?php if($pro_id == $v['id']){?>selected<?php }?>>{$v.title}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </div>
                                
                                <div class="layui-form-item  layui-col-xs2">
                                    <div class="layui-inline" style="width: 98%">
                                        <select name="status" id="status">
                                            <option value="0" <?php if($status == 0){?>selected<?php }?>>检查状态</option>
                                            <option value="1" <?php if($status == 1){?>selected<?php }?>>未检</option>
                                            <option value="2" <?php if($status == 2){?>selected<?php }?>>已检</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-form-item  layui-col-xs2">
                                    <div class="layui-inline" style="width: 98%">
                                        <input type="text" id="keyword" value="{$keyword}"
                                            placeholder="请输入场所名称"  class="layui-input" />
                                    </div>
                                </div>
                                
                                <a class="layui-btn layui-btn-sm" onclick="sousuo();">搜索</a>
                            </form>
                        </div>
                    <div class="layui-card-body">
                        
						<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                        <ul class="layui-tab-title" style="padding-top: 10px">
                            <li class="{if $Request.action == 'statistics'}layui-this{/if}">
                                <a href="{:url('pro/statistics')}">检查概况表</a>
                            </li>
                            <li class="{if $Request.action == 'dangerStatistics'}layui-this{/if}">
                                <a href="{:url('pro/dangerStatistics')}">隐患统计表</a>
                            </li>
                            <li class="{if $Request.action == 'placeStatistics'}layui-this{/if}">
                                <a href="{:url('pro/placeStatistics')}">场所隐患清单</a>
                            </li>
                        </ul>
                        </div>
                        
                        <div class="layui-table-body layui-table-main">
                            <table class="layui-table" style="width: 100% !important;">
                                <thead  id="exceltitle">
                                <tr>
                                    <th>序号</th>
                                    <th>场所类别</th>
                                    <th>场所名</th>
                                    <th>异常状态</th>
                                    <th>场所面积</th>
                                    <th>建筑高度</th>
                                    <th>场所地址</th>
                                    <th>消防负责人</th>
                                    <th>联系电话</th>
                                    <th>得分</th>
                                    <th>隐患条数</th>
                                    <th>隐患条款</th>
                                    <th>不符合描述</th>
                                    <th>排查人员</th>
                                    <th>排查时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody id="excelnr">
                                {foreach name="list" item="vo"}
                                <tr>
                                    <td >{$vo.id}</td>
                                    <td >{$vo.proname}</td>
                                    <td >{$vo.company_name}</td>
                                    <td >{$vo.statusname}</td>
                                    <td >{$vo.area}</td>
                                    <td >{$vo.height}</td>
                                    <td >{$vo.address}</td>
                                    <td >{$vo.fzname}</td>
                                    <td >{$vo.lxtel}</td>
                                    <td >{$vo.score}</td>
                                    <td >{$vo.yhcount}</td>
                                    <td>
                                        {foreach name="vo.CheckListDetails" item="vv"}
                                        <div style=" margin-top:10px; width: 100%; float: left;">
                                            {$vv['topicname']} 
                                            <p style=" clear: both; height: 5px;"></p>
                                            {notempty name="vv.imageslist"}
                                                {foreach name="vv.imageslist" item="vvimg"}
                                                    {notempty name="vvimg"}
                                                    <img src="{$vvimg}" style=" width:80px; height:120px; display: block; margin: 5px; float: left;"/>
                                                    {/notempty}
                                                {/foreach}
                                            {/notempty}
                                        </div>
                                        {/foreach}
                                    </td>
                                    
                                    <td>
                                        {foreach name="vo.CheckListDetails" item="vv"}
                                        <div style=" margin-top:10px; width: 100%; float: left;">
                                            {notempty name="vv.desc"}
                                            <p style=" color:red;">不符合描述：{$vv['desc']}</p>
                                            {/notempty}
                                        </div>
                                        {/foreach}
                                    </td>
                                    <td >{$vo.checkname}</td>
                                    <td >{$vo.checktime}</td>
                                    <td style=" text-align: center;">
                                        {foreach name="vo.checkreport" item="v"}
                                        <a class="layui-btn layui-bg-cyan layui-btn-sm" onclick="pdfshowpost({$v['Id']});">{$v.title}</a>
                                        {/foreach}
                                        {notempty name="vo.CheckListDetails[0]['images']"}
                                        <a class="layui-btn layui-bg-cyan layui-btn-sm" style=" margin-top:20px;" onclick="exportImage({$vo['id']});">下载隐患图片</a>
                                        {/notempty}
                                    </td>
                                </tr>
                                {/foreach}
                                {empty name="list"}
                                    <tr>
                                        <td colspan="15" align="center">暂无数据</td>
                                    </tr>
                                {/empty}
                                </tbody>
                            </table>
                        </div>
                    </div>
                    {$list|raw}
                </div>

            </div>
        </div>
    </div>
</div>
</body>
{include file="public/footer" /}

<script>
    
    function exportexcel(){
        var keyword= $("#keyword").val();
        var pro_id= $("#pro_id").val();
        var district_id= $("#district_id").val();
        var status= $("#status").val();
        window.location.href='/'+$("#admin_map").val()+'/pro/exportExcelYh?pro_id='+pro_id+'&keyword='+keyword+'&district_id='+district_id+'&status='+status;
    }

    
    
    function pdfshowpost(id){
        // var exceltitle=$("#exceltitle").html();
        // var excelnr=$("#excelnr").html();
        // excel(exceltitle,excelnr,'场所隐患清单.xls');
        $.post("{:url('pdfshowpost')}",{id:id},function(data,status){
            parent.layer.msg(data.msg, {time: 1000}, function () {
                window.open(data.url)
            });
        });
    }
    function exportImage(id){
        $.post("{:url('exportImage')}",{id:id},function(data,status){
            parent.layer.msg(data.msg, {time: 1000}, function () {
                window.open(data.url)
            });
        });
    }
    
    
    function sousuo(){
        var keyword= $("#keyword").val();
        var pro_id= $("#pro_id").val();
        var district_id= $("#district_id").val();
        var status= $("#status").val();
        window.location.href='/'+$("#admin_map").val()+'/pro/placeStatistics?pro_id='+pro_id+'&keyword='+keyword+'&district_id='+district_id+'&status='+status;
    }

</script>
</html>